{% extends 'base.html' %}

{% block title %}仪表板{% endblock %}

{% block content %}
<div class="container">
    <div class="row mb-4">
        <div class="col-md-12">
            <h1>欢迎, {{ current_user.username }}</h1>
            <p class="lead">用户类型: {{ '管理员' if current_user.user_type == 'admin' else '普通用户' }}</p>
        </div>
    </div>

    <div class="row">
        <!-- 快速操作区 -->
        <div class="col-md-8">
            <div class="card mb-4">
                <div class="card-header bg-primary text-white">
                    <h5 class="mb-0">快速操作</h5>
                </div>
                <div class="card-body">
                    <div class="row g-4">
                        <div class="col-md-4">
                            <a href="{{ url_for('data.planting_list') }}" class="text-decoration-none">
                                <div class="d-flex align-items-center p-3 bg-light rounded">
                                    <i class="fas fa-seedling fa-2x text-success me-3"></i>
                                    <div>
                                        <h6 class="mb-0">种植数据</h6>
                                        <small class="text-muted">管理种植记录</small>
                                    </div>
                                </div>
                            </a>
                        </div>
                        <div class="col-md-4">
                            <a href="{{ url_for('data.crop_list') }}" class="text-decoration-none">
                                <div class="d-flex align-items-center p-3 bg-light rounded">
                                    <i class="fas fa-leaf fa-2x text-primary me-3"></i>
                                    <div>
                                        <h6 class="mb-0">作物品种</h6>
                                        <small class="text-muted">管理品种信息</small>
                                    </div>
                                </div>
                            </a>
                        </div>
                        <div class="col-md-4">
                            <a href="{{ url_for('data.environment_list') }}" class="text-decoration-none">
                                <div class="d-flex align-items-center p-3 bg-light rounded">
                                    <i class="fas fa-cloud-sun fa-2x text-warning me-3"></i>
                                    <div>
                                        <h6 class="mb-0">环境数据</h6>
                                        <small class="text-muted">管理环境记录</small>
                                    </div>
                                </div>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 数据分析区 -->
            <div class="card">
                <div class="card-header bg-info text-white">
                    <h5 class="mb-0">数据分析</h5>
                </div>
                <div class="card-body">
                    <div class="row g-4">
                        <div class="col-md-6">
                            <a href="{{ url_for('analysis.structure') }}" class="text-decoration-none">
                                <div class="d-flex align-items-center p-3 bg-light rounded">
                                    <i class="fas fa-chart-pie fa-2x text-primary me-3"></i>
                                    <div>
                                        <h6 class="mb-0">结构分析</h6>
                                        <small class="text-muted">种植结构分析</small>
                                    </div>
                                </div>
                            </a>
                        </div>
                        <div class="col-md-6">
                            <a href="{{ url_for('analysis.benefit') }}" class="text-decoration-none">
                                <div class="d-flex align-items-center p-3 bg-light rounded">
                                    <i class="fas fa-chart-line fa-2x text-success me-3"></i>
                                    <div>
                                        <h6 class="mb-0">效益分析</h6>
                                        <small class="text-muted">经济效益分析</small>
                                    </div>
                                </div>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 系统信息区 -->
        <div class="col-md-4">
            {% if current_user.user_type == 'admin' %}
            <div class="card mb-4">
                <div class="card-header bg-primary text-white">
                    <h5 class="mb-0">管理功能</h5>
                </div>
                <div class="card-body">
                    <a href="{{ url_for('admin.users') }}" class="btn btn-outline-primary w-100 mb-3">
                        <i class="fas fa-users me-2"></i>用户管理
                    </a>
                </div>
            </div>
            {% endif %}

            <div class="card">
                <div class="card-header bg-success text-white">
                    <h5 class="mb-0">数据清洗</h5>
                </div>
                <div class="card-body">
                    <a href="{{ url_for('cleaning.planting_clean') }}" class="btn btn-outline-success w-100 mb-3">
                        <i class="fas fa-seedling me-2"></i>种植数据清洗
                    </a>
                    <a href="{{ url_for('cleaning.environment_clean') }}" class="btn btn-outline-success w-100 mb-3">
                        <i class="fas fa-cloud-sun me-2"></i>环境数据清洗
                    </a>
                    <a href="{{ url_for('cleaning.data_integration') }}" class="btn btn-outline-success w-100">
                        <i class="fas fa-database me-2"></i>数据整合
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 